]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
altTab: Don't refuse to work when a pointer grab is in place
authorAdel Gadllah <adel.gadllah@gmail.com>
Fri, 21 Oct 2011 07:12:17 +0000 (09:12 +0200)
committerAdel Gadllah <adel.gadllah@gmail.com>
Fri, 21 Oct 2011 07:12:17 +0000 (09:12 +0200)
Allow push_modal to optionally only work with a keyboard only grab and
use that in altTab as a fallback to allow switching windows while a pointer grab
is in effect (like during DND operations).

https://bugzilla.gnome.org/show_bug.cgi?id=660457

js/ui/altTab.js
js/ui/main.js
src/shell-global.c
src/shell-global.h

index e17344f2885a3b243386d26333b6ecb9fe9f538e..20bad20d095942b66f9b8fa924cd3592326b80db 100644 (file)
@@ -170,8 +170,12 @@ AltTabPopup.prototype = {
         if (localApps.length == 0 && otherApps.length == 0)
             return false;
 
-        if (!Main.pushModal(this.actor))
-            return false;
+        if (!Main.pushModal(this.actor)) {
+            // Probably someone else has a pointer grab, try again with keyboard only
+            if (!Main.pushModal(this.actor, global.get_current_time(), Meta.ModalOptions.POINTER_ALREADY_GRABBED)) {
+                return false;
+            }
+        }
         this._haveModal = true;
         this._modifierMask = primaryModifier(mask);
 
index 4c97440dfed91ce015aa77954914fd2c55ef8635..e08de3df84067ade13bf8d59bf37c3524eaf74c0 100644 (file)
@@ -668,14 +668,17 @@ function _findModal(actor) {
  * initiated event.  If not provided then the value of
  * global.get_current_time() is assumed.
  *
+ * @options: optional Meta.ModalOptions flags to indicate that the
+ *           pointer is alrady grabbed
+ *
  * Returns: true iff we successfully acquired a grab or already had one
  */
-function pushModal(actor, timestamp) {
+function pushModal(actor, timestamp, options) {
     if (timestamp == undefined)
         timestamp = global.get_current_time();
 
     if (modalCount == 0) {
-        if (!global.begin_modal(timestamp)) {
+        if (!global.begin_modal(timestamp, options ? options : 0)) {
             log('pushModal: invocation of begin_modal failed');
             return false;
         }
index 13ce7b7af9ff4aff0a2e70f88eceecd19037deac..7b3e8f528affdd7cc406f7bdae05f5fbd0be5a76 100644 (file)
@@ -864,11 +864,11 @@ _shell_global_get_gjs_context (ShellGlobal *global)
  *  was previouly called.
  */
 gboolean
-shell_global_begin_modal (ShellGlobal *global,
-                          guint32      timestamp)
+shell_global_begin_modal (ShellGlobal       *global,
+                          guint32           timestamp,
+                          MetaModalOptions  options)
 {
-  return meta_plugin_begin_modal (global->plugin, global->stage_xwindow,
-                                  None, 0, timestamp);
+  return meta_plugin_begin_modal (global->plugin, global->stage_xwindow, None, options, timestamp);
 }
 
 /**
index cc5cfe7c0f6fd3bc0abfa7a718ed298919f50164..dcb1517ed3eb6629750226f24f6e36f17077dcf7 100644 (file)
@@ -39,7 +39,8 @@ guint32        shell_global_get_current_time          (ShellGlobal *global);
 
 /* Input/event handling */
 gboolean shell_global_begin_modal            (ShellGlobal         *global,
-                                              guint32              timestamp);
+                                              guint32             timestamp,
+                                              MetaModalOptions    options);
 void     shell_global_end_modal              (ShellGlobal         *global,
                                               guint32              timestamp);